package com.xiaomengkuan.user.incrementer;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.xiaomengkuan.common.incrementer.IdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.SystemMetaObject;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;

/**
 * @author Faraj Mujey
 * -- Creation Time: 2021-02-05 3:34 下午, File Encoding: utf8 --
 */
@Slf4j
@Primary
@Component
public class UserIdGenerator extends IdGenerator {

    @Override
    public String nextUUID(Object entity) {
        String commonId = super.nextUUID(entity);
        String id = commonId.replace("ysj", "scu");
        log.debug("new user [{}]", id);
        return id;
    }
}
